from machine import RTC
from machine import Timer , I2C ,Pin
import lc ,machine
sp1=Pin(lc.key1,Pin.IN, machine.Pin.PULL_UP)
kf=0
import lcd12864
i2c = I2C(0,scl=Pin(lc.scl), sda=Pin(lc.sda),freq=400000)
lcd12864.i2c=i2c
def tp(str):
    print(str)
    lcd12864.print8(str+"     ",0,5)
def irqsync(sp1):
    global kf
    kf+=1
#     disable_irq()
    print("irq sync time",kf)
    tp(str(kf))
#     PFC8563.sync(tp)
#     tpe()
sp1.irq(trigger=Pin.IRQ_FALLING,handler=irqsync)
# machine.lightsleep()